package com.hrbxlh.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.hrbxlh.actionImpl.ClassActionImpl;
import com.hrbxlh.actionImpl.CourseActionImpl;
import com.hrbxlh.actionImpl.DepartMentActionImpl;
import com.hrbxlh.actionImpl.MemberActionImpl;
import com.hrbxlh.actionImpl.ParamActionImpl;
import com.hrbxlh.actionImpl.ProfessDirectionActionImpl;
import com.hrbxlh.actionImpl.ProfessionActionImpl;
import com.hrbxlh.actionImpl.RelationActionImpl;
import com.hrbxlh.util.ConfigFileUtil;
import com.hrbxlh.util.DateUtil;
import com.hrbxlh.util.SessionValues;


/**
* -------------------------------------------------------
* Copyright (c) 2017, 鑫联华信息科技股份有限公司
* All rights reserved.
* FileName：RelationAction.java
* Description：排课管理action类
* History：
* Date           Author               Desc
* 2017.04.17	  xzx                  建立	
* -------------------------------------------------------
*/
@Controller
public class RelationAction {
	
	@Autowired
	@Qualifier("departMentActionImpl")
	private DepartMentActionImpl departMentActionImpl;
	
	@Autowired
	@Qualifier("classActionImpl")
	private ClassActionImpl classActionImpl;
	
	@Autowired
	@Qualifier("courseActionImpl")
	private CourseActionImpl courseActionImpl;
	
	@Autowired
	@Qualifier("professionActionImpl")
	private ProfessionActionImpl professionActionImpl;
	
	@Autowired
	@Qualifier("professDirectionActionImpl")
	private ProfessDirectionActionImpl professDirectionActionImpl;

	@Autowired
	@Qualifier("relationActionImpl")
	private RelationActionImpl relationActionImpl;
	
	@Autowired
	@Qualifier("paramActionImpl")
	private ParamActionImpl paramActionImpl;
	
	@Autowired
	@Qualifier("memberActionImpl")
	private MemberActionImpl memberActionImpl;

	/**
	 * @description 进入排课管理页面      
	 * 				管理员在课程管理页面的某一条课程点击进来的时候也用这个，要带着那个页面的参数过来
	 * @param request
	 * @param response
	 * @return  进入排课管理页面
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipScheduleMana", method = RequestMethod.GET)
	public ModelAndView skipScheduleMana(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			preParamMap.put("departmentList", departmentList);
			//带上课时间的参数
			Map<String, Object> paramMap = paramActionImpl.getParamDetail();
			preParamMap.put("paramMap", paramMap);
			//带入当前的周一至周日
			List<String> dateList = DateUtil.dateToWeek(new Date());
			preParamMap.put("dateList", dateList);
			//如果是有条件进来的，需要查询现在的这个地点的课表信息
			if(preParamMap.get("siteId") != null){
				//获取日期及地点的课表信息
				List<Map<String, Object>> siteClassTab = relationActionImpl.getSiteClassTab(preParamMap);
				preParamMap.put("classTab", siteClassTab);                    
			}
			resultMap = preParamMap;
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
		    Map<String, Object> parameterMap = paramActionImpl.getParamDetail();
		    resultMap.put("parameterMap", parameterMap);
		    //查询全部课程
			List<Map<String, Object>> courseListAll = courseActionImpl.getAllCourse();
			resultMap.put("courseListAll", courseListAll);
		    //页面名称
			pageName = "pc/scheduleMana";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转排课管理页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	/**院系联动
	 * @dscribe 获取某个院系下面的专业
	 * @param request departmentId院系id
	 * @param response
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/getMyProfessionList", method = RequestMethod.POST)
	public void  getMyProfessionList (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//获取院系下面的专业信息
			List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(paramMap);
			//返回信息
			resultMap.put("professionList", professionList);
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("院系联动出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	/**专业联动
	 * @dscription 获取某个专业下的全部课程信息  
	 * 				获取某个专业下的全部教师信息  
	 * 				 获取某个专业下的全部班级信息  
	 * 				获取某个专业下的全部地点信息
	 * @param request professionId
	 * @param response
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/getMyProCourseList", method = RequestMethod.POST)
	public void  getMyProCourseList (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//获取专业下面的课程信息
			List<Map<String, Object>> courseList = courseActionImpl.getCourseByProfessionId(paramMap);
			resultMap.put("courseList", courseList);
			//获取这个专业下的全部教师
			List<Map<String, Object>> userList = professionActionImpl.getUserByProfessionId(paramMap);
			resultMap.put("userList", userList);
			//获取某个专业下的全部班级信息
			List<Map<String, Object>> classList = professionActionImpl.getClassByProfessionId(paramMap);
			resultMap.put("classList", classList);
			//获取这个专业下的全部地点
			List<Map<String, Object>> siteList = professionActionImpl.getSiteByProfessionId(paramMap);
			resultMap.put("siteList", siteList);
			//获取这个专业下的全部的专业方向信息
			List<Map<String, Object>> directList = professDirectionActionImpl.getDirectByprofessId(paramMap);
			resultMap.put("directList", directList);
			//查询全部课程
			List<Map<String, Object>> courseListAll = courseActionImpl.getAllCourse();
			resultMap.put("courseListAll", courseListAll);
			//查询全部老师
			List<Map<String, Object>> teacherListAll = memberActionImpl.getTeachers();
			resultMap.put("teacherListAll", teacherListAll);
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("专业联动出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter(); 
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	/**排课管理（手动的）
	 * @dscription 保存排课信息
	 * @param 课程表集合  list中每一个的参数：
	 * 		     课程类型： 教师排课 给1 学生选课给 2
	 * 		     院系id departmentId 
	 *        专业id professionId 
	 *        课程id courseId
	 *        老师id stuorteaId
	 *        班级id classId(如果是学生选课给0)
	 *        地点id siteId
	 *        排第几节课 （上午1节是1 上午2节是2  下午1节是3 下午2节是4 晚上一节是5）
	 *        上课年月日 -》2017-01-03
	 *        
	 *        注意：自己获取上课时间参数存数据库
	 *        
	 *        
//			Map<String, Object> mapUse=new HashMap<String, Object>();
//			List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
//			Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("selectMark", 1);
//			m1.put("departmentId", 1);
//			m1.put("professionId", 1);
//			m1.put("courseId", 25);
//			m1.put("stuorteaId", 1);
//			m1.put("classId", 19);
//			m1.put("siteId", 2);
//			m1.put("classNum", 2);
//			m1.put("classDate", "2017-04-05");
//			Map<String, Object> m2 = new HashMap<String, Object>();
//			m2.put("selectMark", 1);
//			m2.put("departmentId", 1);
//			m2.put("professionId", 1);
//			m2.put("courseId", 25);
//			m2.put("stuorteaId", 1);
//			m2.put("classId", 19);
//			m2.put("siteId", 1);
//			m2.put("classNum", 1);
//			m2.put("classDate", "2017-04-06");
//			Map<String, Object> m3 = new HashMap<String, Object>();
//			m3.put("selectMark", 1);
//			m3.put("departmentId", 1);
//			m3.put("professionId", 1);
//			m3.put("courseId", 25);
//			m3.put("stuorteaId", 1);
//			m3.put("classId", 19);
//			m3.put("siteId", 1);
//			m3.put("classNum", 1);
//			m3.put("classDate", "2017-04-07");
//			list.add(m1);
//			list.add(m2);
//			list.add(m3);
//			mapUse.put("tabList", list);
//			jsonStr = mapper.writeValueAsString(mapUse);
	 * @return 成功失败标识
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/saveCourseTab", method = RequestMethod.POST)
	public void  saveCourseTab (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		String resultStr = "fail";
		try { 
			/**/
//			Map<String, Object> m = new HashMap<String, Object>();
//			m.put("courseId", 1);
//			m.put("siteId", 31);
//			m.put("departmentId", 1);
//			m.put("professionId", 1);
//			m.put("stuorteaId", "8888888");
//			m.put("classNum", 1);
//			m.put("selectMark", 2);
//			m.put("mainId", 55);
//			m.put("classDate", "2017-06-29");
//			List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
//			list.add(m);
//			Map<String, Object> ma = new HashMap<String, Object>();
//			ma.put("tabList", list);
//			jsonStr= mapper.writeValueAsString(ma);
			/**/
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//获取课表
			List<Map<String, Object>> tabList = (List<Map<String, Object>>)paramMap.get("tabList");
			//保存课表
			Map<String, Object> saveResultMap = relationActionImpl.saveClassTab(tabList);
			boolean saveMark = (Boolean)saveResultMap.get("result");
			resultStr = (saveMark) ? "success" : "fail";
			resultMap.put("result", resultStr);
			if(!saveMark){
				resultMap.put("failMsg", saveResultMap.get("failMsg"));
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("手动排课出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}	
	
	/**排课管理（自动的）
	 * @dscription 保存排课信息
	 * @param 课程类型： 教师排课 给1 学生选课给 2
	 * 		     院系id departmentId 
	 *        专业id professionId 
	 *        课程id courseId
	 *        老师id stuorteaId
	 *        班级id classId(如果是学生选课给0)
	 *        地点id siteId
	 *        排第几节课的集合    1-5 list<Integer>
	 *        排星期几的集合  list<Integer>  1-7
	 *        排课时间段开始时间     classDateStart
	 *        排课时间段结束时间     classDateEnd
	 *        注意：自己获取上课时间参数存数据库
//			Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("selectMark", 1);
//			m1.put("departmentId", 1);
//			m1.put("professionId", 1);
//			m1.put("courseId", 25);
//			m1.put("stuorteaId", 1);
//			m1.put("classId", 19);
//			m1.put("siteId", 2);
//			m1.put("classDateStart", "2017-04-02");
//			m1.put("classDateEnd", "2017-04-08");
//			List<Integer> weekList = new ArrayList<Integer>();
//			weekList.add(1);
//			weekList.add(2);
//			m1.put("weekList", weekList);
//			List<Integer> classNumList = new ArrayList<Integer>();
//			classNumList.add(1);
//			classNumList.add(2);
//			m1.put("classNumList", classNumList);
//			jsonStr = mapper.writeValueAsString(m1);
	 * @return 成功失败标识
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/saveAutoCourseTab", method = RequestMethod.POST)
	public void  saveAutoCourseTab (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		String resultStr = "fail";
		try { 
			/**/
//			Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("selectMark", 2);
//			m1.put("departmentId", 1);
//			m1.put("professionId", 1);
//			m1.put("courseId", 1);
//			m1.put("stuorteaId", "1111");
//			m1.put("mainId", 55);
//			m1.put("siteId", 31);
//			m1.put("classDateStart", "2017-07-15");
//			m1.put("classDateEnd", "2017-07-30");
//			List<Integer> weekList = new ArrayList<Integer>();
//			weekList.add(1);
//			weekList.add(2);
//			m1.put("weekList", weekList);
//			List<Integer> classNumList = new ArrayList<Integer>();
//			classNumList.add(1);
//			classNumList.add(2);
//			m1.put("classNumList", classNumList);
//			jsonStr = mapper.writeValueAsString(m1);
			/**/
			
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//自动排课
			Map<String, Object> saveResultMap = relationActionImpl.saveAutoClassTab(paramMap);
			boolean saveMark = (Boolean)saveResultMap.get("result");
			resultStr = (saveMark) ? "success" : "fail";
			resultMap.put("result", resultStr);
			if(!saveMark){
				resultMap.put("failMsg", saveResultMap.get("failMsg"));
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("自动排课出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	/**
	 * @dscription 查询上一周下一周的日期及星期 如果有地点条件，将这个时间范围内的上课地点是这里的课程带回来
	 * 				搜索某个时间的时候，也用这个
//  		Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("nowDate", "2017-04-03");
//			m1.put("siteId", 1);
//			jsonStr = mapper.writeValueAsString(m1);
	 * @return 成功失败标识
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/getLastAndAfterTab", method = RequestMethod.POST)
	public void  getLastAndAfterTab (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			String dateStr = (String)paramMap.get("nowDate");
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			List<String> dateList = DateUtil.dateToWeek(sdf.parse(dateStr));
			resultMap.put("dateList", dateList);
			//获取日期及地点的课表信息
			if(paramMap.get("siteId") != null){
				paramMap.put("dateList", dateList);
				List<Map<String, Object>> siteClassTab = relationActionImpl.getSiteClassTab(paramMap);
				resultMap.put("classTab", siteClassTab);                    
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("查询课表出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}

	/**
	 * @description 管理员的课程管理页面  进页及搜索
	 * 列表展示 序号 课程名 专业名 上课时间 上课节数 上课老师名 上课地点   分页
	 * 搜索条件  院系  专业 教师 课程方向 课程名（文本框填写的不是id）
	 * @param request
	 * @param response
//			Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("pageNow", 1);
//			m1.put("pageSize", 10);
//			jsonStr = mapper.writeValueAsString(m1);
	 * @return  
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipManagerCourseTabMana", method = RequestMethod.GET)
	public ModelAndView skipManagerCourseTabMana(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//查询全部课表信息
			Map<String,Object> tabListMap = relationActionImpl.getManagerCourseTabList(paramMap);
			if(tabListMap != null){
				resultMap.put("tabList", tabListMap.get("tabList"));
				resultMap.put("totalPage", tabListMap.get("totalPage"));
				resultMap.put("pageNow", tabListMap.get("pageNow"));
			}
			//返回条件
			resultMap.put("pageSize", paramMap.get("pageSize"));
			resultMap.put("departmentId", paramMap.get("departmentId"));
			resultMap.put("professionId", paramMap.get("professionId"));
			resultMap.put("stuorteaId", paramMap.get("stuorteaId"));
			resultMap.put("mainId", paramMap.get("mainId"));
			resultMap.put("courseName", paramMap.get("courseName"));
			//全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			if(paramMap.get("departmentId") != null){
				//获取院系下面的专业信息
				List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(paramMap);
				resultMap.put("professionList", professionList);
			}
			if(paramMap.get("professionId") != null){
				//获取这个专业下的全部教师
				List<Map<String, Object>> userList = professionActionImpl.getUserByProfessionId(paramMap);
				resultMap.put("userList", userList);
				//获取这个专业下的全部的专业方向信息
				List<Map<String, Object>> directList = professDirectionActionImpl.getDirectByprofessId(paramMap);
				resultMap.put("directList", directList);
			}
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/managerCourseTabMana";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转课程管理页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	/**
	 * @dscription 删除某条课程表信息
	 * @param request relationId 课表id
	 * @param response
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")  
	@RequestMapping(value = "/delOneClassTab", method = RequestMethod.POST)
	public void  delOneClassTab (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			/**/
//			Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("relationId", 358);
//			jsonStr = mapper.writeValueAsString(m1);
			/**/
			
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//删除课表
			Map<String, Object> delMap = relationActionImpl.delClassTabById(paramMap);
			if((Boolean)delMap.get("result")){
				resultMap.put("result", "success");
			}else{
				resultMap.put("result", "fail");
			}
			
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("删除课程表出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	
	
	/**
	 * @description 进入学生选课页面  - 课程简介 和选课列表(分页)  如果不和选课列表放在一起就不需要分页的参数
	 * @param request
	 * @param response
	 * @return  进入学生选课页面
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipStuSelectCourses", method = RequestMethod.GET)
	public ModelAndView skipStuSelectCourses(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//1,2全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			//1选课课程列表
			List<Map<String, Object>> courseList = relationActionImpl.getSelectCourses(preParamMap);
			resultMap.put("courseList", courseList);
			//1排课了的老师的列表
			List<Map<String, Object>> teacherList = relationActionImpl.getSelectTeacherList(preParamMap);
			resultMap.put("teacherList", teacherList);
			//2获取选课的list
			Map<String, Object> selectMap = relationActionImpl.getSelectList(preParamMap);
			if(selectMap != null){
				resultMap.put("selectList", selectMap.get("selectList"));
				resultMap.put("totalPage", selectMap.get("totalPage"));
				resultMap.put("pageNow", selectMap.get("pageNow"));
			}
			//返回条件
			resultMap.put("pageSize", preParamMap.get("pageSize"));
			resultMap.put("departmentId", preParamMap.get("departmentId"));
			resultMap.put("professionId", preParamMap.get("professionId"));
			resultMap.put("stuorteaId", preParamMap.get("stuorteaId"));
			resultMap.put("mainId", preParamMap.get("mainId"));
			resultMap.put("courseName", preParamMap.get("courseName"));
			resultMap.put("courseCredit", preParamMap.get("courseCredit"));
			String[] keysArray = {"server_address", "project_name"};
			//图片前缀
			Map<String, Object> urlmap = ConfigFileUtil.getFileMessage("UtilFile.properties", keysArray);
			String imageUrl = (String)urlmap.get("server_address")+(String)urlmap.get("project_name")+"images/pc/";
			resultMap.put("url", imageUrl);
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/stuSelectCourses";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转选课页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	/**
	 * @description 学生选择课程  post
	 * @param  courseId
	 * @param 
//  		Map<String, Object> m1 = new HashMap<String, Object>();
//			m1.put("courseId", 25);
//			jsonStr = mapper.writeValueAsString(m1);
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/stuSelectCourse", method = RequestMethod.POST)
	public void  stuSelectCourse (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//获取登录人信息
			SessionValues session = new SessionValues();
			Map<String, Object> sessionValues = session.getSessionValues(new String[]{"stuorteaId"}, request);
			paramMap.put("stuorteaId", sessionValues.get("stuorteaId"));
			//保存选课信息
			Map<String, Object> saveMap = relationActionImpl.saveStuSelectMsg(paramMap);
			if((Boolean)saveMap.get("result")){
				resultMap.put("result", "success");
			}else{
				resultMap.put("result", "fail");
				resultMap.put("failMsg", saveMap.get("failMsg"));
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("学生选课出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	//分开的学生选课页面  ----------------------------------------------------------------------------------
	/**
	 * @description 进入学生选课页面  - 课程简介
	 * @param request
	 * @param response
	 * @return  进入学生选课页面
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipStuSelIntroction", method = RequestMethod.GET)
	public ModelAndView skipStuSelIntroction(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			//选课课程列表
			List<Map<String, Object>> courseList = relationActionImpl.getSelectCourses(preParamMap);
			resultMap.put("courseList", courseList);
			//排课了的老师的列表
			List<Map<String, Object>> teacherList = relationActionImpl.getSelectTeacherList(preParamMap);
			resultMap.put("teacherList", teacherList);
			//返回条件
			resultMap.put("departmentId", preParamMap.get("departmentId"));
			if(preParamMap.get("departmentId") != null){
				//获取院系下面的专业信息
				List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(preParamMap);
				//返回信息
				resultMap.put("professionList", professionList);
			}
			resultMap.put("professionId", preParamMap.get("professionId"));
			if(preParamMap.get("professionId") != null){
				//获取这个专业下的全部的专业方向信息
				List<Map<String, Object>> directList = professDirectionActionImpl.getDirectByprofessId(preParamMap);
				resultMap.put("directList", directList);
			}
			resultMap.put("mainId", preParamMap.get("mainId"));
			String[] keysArray = {"server_address", "project_name"};
			//图片前缀
			Map<String, Object> urlmap = ConfigFileUtil.getFileMessage("UtilFile.properties", keysArray);
			String imageUrl = (String)urlmap.get("server_address")+(String)urlmap.get("project_name")+"images/pc/";
			resultMap.put("url", imageUrl);
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/stuSelectCourses";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转选课页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	 /**
	 * @description  选课列表(分页)  
	 * @param request
	 * @param response
	 * @return  进入学生选课页面
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipStuSelectCoursesList", method = RequestMethod.GET)
	public ModelAndView skipStuSelectCoursesList(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			//可选课课程列表
			List<Map<String, Object>> courseList = relationActionImpl.getSelectCourses(preParamMap);
			resultMap.put("courseList", courseList);
			//获取选课展示的list
			Map<String, Object> selectMap = relationActionImpl.getSelectList(preParamMap);
			if(selectMap != null){
				//给出是否选课了的标识
				List<Map<String, Object>> selectList = relationActionImpl.setSelectMark((List<Map<String, Object>>)selectMap.get("selectList"),request);
				resultMap.put("selectList", selectList);
				
				resultMap.put("totalPage", selectMap.get("totalPage"));
				resultMap.put("pageNow", selectMap.get("pageNow"));
			}
			//获取这个人选择的课程
			//List<Map<String, Object>> mySelectList = relationActionImpl.getRelStuCourseListById(request);
			//resultMap.put("mySelectList", mySelectList);
			//返回条件
			resultMap.put("pageSize", preParamMap.get("pageSize"));
			resultMap.put("departmentId", preParamMap.get("departmentId"));
			if(preParamMap.get("departmentId") != null){
				//获取院系下面的专业信息
				List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(preParamMap);
				//返回信息
				resultMap.put("professionList", professionList);
			}
			resultMap.put("professionId", preParamMap.get("professionId"));
			if(preParamMap.get("professionId") != null){
				//获取这个专业下的全部的专业方向信息
				List<Map<String, Object>> directList = professDirectionActionImpl.getDirectByprofessId(preParamMap);
				resultMap.put("directList", directList);
				//获取这个专业下的全部教师
				List<Map<String, Object>> userList = professionActionImpl.getUserByProfessionId(preParamMap);
				resultMap.put("userList", userList);
			}
			resultMap.put("stuorteaId", preParamMap.get("stuorteaId"));
			resultMap.put("mainId", preParamMap.get("mainId"));
			resultMap.put("courseName", preParamMap.get("courseName"));
			resultMap.put("courseCredit", preParamMap.get("courseCredit"));
			String[] keysArray = {"server_address", "project_name"};
			//图片前缀
			Map<String, Object> urlmap = ConfigFileUtil.getFileMessage("UtilFile.properties", keysArray);
			String imageUrl = (String)urlmap.get("server_address")+(String)urlmap.get("project_name")+"images/pc/";
			resultMap.put("url", imageUrl);
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/stuSelectCoursesList";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转选课页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}

	/**
	 * @description 点击某个课表信息进入这个课的详情
	 * @param request  relationId
	 * @param response
	 * @return  进入修改课表的页面
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipSaveRelationPage", method = RequestMethod.GET)
	public ModelAndView skipSaveRelationPage(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//查询这条课表的全部信息
			Map<String,Object> relationMsg = relationActionImpl.getOneRelationById(preParamMap);
			resultMap.put("relationMsg", relationMsg);
			//查询全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			//查询某个院系的全部专业
			List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(relationMsg);
			resultMap.put("professionList", professionList);
			//查询某个专业的全部专业方向
			List<Map<String, Object>> directList = professDirectionActionImpl.getDirectByprofessId(relationMsg);
			resultMap.put("directList", directList);
			//查询某个专业的全部地点
			List<Map<String, Object>> siteList = professionActionImpl.getSiteByProfessionId(relationMsg);
			resultMap.put("siteList", siteList);
			//查询某个专业的全部课程
			List<Map<String, Object>> courseList = courseActionImpl.getCourseByProfessionId(relationMsg);
			resultMap.put("courseList", courseList);
			//查询某个专业的全部老师
			List<Map<String, Object>> userList = professionActionImpl.getUserByProfessionId(relationMsg);
			resultMap.put("userList", userList);
			//查询某个专业的全部班级
			List<Map<String, Object>> classList = professionActionImpl.getClassByProfessionId(relationMsg);
			//如果是选课的把选课的班级也放进去
			Map<String, Object> selectClass = relationActionImpl.getSelectClassOne(relationMsg);
			if(selectClass != null){
				classList.add(selectClass);
			}
			resultMap.put("classList", classList);
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/saveOneClassTab";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转课程表详情页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	/**
	 * @description  保存修改课表信息一条
	 * @param  
	 * @param 
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/saveRelationPage", method = RequestMethod.POST)
	public void  saveRelationPage (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			Map<String,Object> saveResultMap = relationActionImpl.saveOneCourseTab(paramMap);
			if((Boolean)saveResultMap.get("result")){
				resultMap.put("result", "success");
			}else{
				resultMap.put("result", "fail");
				resultMap.put("failMsg", saveResultMap.get("failMsg"));
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("保存课表出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	
	/**
	 * @description  管理员的课程管理-任课概要 分页
	 * @param  
	 * @param 
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipTeaReCourseMana", method = RequestMethod.GET)
	public ModelAndView skipTeaReCourseMana(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//查询全部院系信息
			//全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			//如果选择了院系，查询这个院系下全部专业
			if(preParamMap.get("departmentId") != null){
				//获取院系下面的专业信息
				List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(preParamMap);
				resultMap.put("professionList", professionList);
			}
			//查询全部教师与课程之间的关系列表
			Map<String, Object> resultAllMap = relationActionImpl.getTeaReCourseList(preParamMap);
			if(resultAllMap != null){
				//返回值
				resultMap.put("teaReCourseList", resultAllMap.get("reList"));
				resultMap.put("totalPage", resultAllMap.get("totalPage"));
				resultMap.put("pageNow", resultAllMap.get("pageNow"));
			}
			resultMap.put("pageSize", preParamMap.get("pageSize"));
			//返回条件
			resultMap.put("departmentId", preParamMap.get("departmentId"));
			resultMap.put("professionId", preParamMap.get("professionId"));
			resultMap.put("userName", preParamMap.get("userName"));
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/teaReCourseMana";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转任课概要页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	/**解绑教师与课程信息
	 * @description  管理员的课程管理-任课概要 解绑教师与课程信息
	 * @param  删除全部关联信息   传课程id，教师id，类型，0620班级id
	 * @param 
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/unbundlingRelation", method = RequestMethod.POST)
	public void  unbundlingRelation (HttpServletResponse response, HttpServletRequest request, String jsonStr) throws IOException {
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//返回字符串
		String reJsonStr = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try { 
			/**/
//			Map<String,Object> map = new HashMap<String, Object>();
//			map.put("courseId", 1);
//			map.put("stuorteaId", "1210711012");
//			map.put("couSelectMark", 1);
//			jsonStr = mapper.writeValueAsString(map);
			/**/
			
			//获取参数值
			Map<String,Object> paramMap = mapper.readValue(jsonStr, resultMap.getClass());
			//解绑方法
			boolean result = relationActionImpl.unbundlingRelation(paramMap);
			if(result){
				resultMap.put("result", "success");
			}else{
				resultMap.put("result", "fail");
				resultMap.put("failMsg", "解绑失败");
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("解绑出现异常", e);
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			System.out.println("返回的："+reJsonStr);
			response.setContentType("text/html;charset=UTF-8");
			PrintWriter write = response.getWriter();
			write.println(reJsonStr);
			write.flush();
		}
	}
	
	/**
	 * @description  管理员-课程库  分页
	 * @param   跳转：专业id  专业方向id 教师名字userName
	 * @param 
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/skipCourseList", method = RequestMethod.GET)
	public ModelAndView skipCourseList(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			//查询全部院系信息
			//全部院系
			List<Map<String, Object>> departmentList = departMentActionImpl.getDepartmentAll(new HashMap<String, Object>());
			resultMap.put("departmentList", departmentList);
			//如果选择了院系，查询这个院系下全部专业
			if(preParamMap.get("departmentId") != null){
				//获取院系下面的专业信息
				List<Map<String, Object>> professionList = departMentActionImpl.getMyProfessionList(preParamMap);
				resultMap.put("professionList", professionList);
			}
			//如果选择了专业，要查询这个专业下的所有专业方向
			if(preParamMap.get("professionId") != null){
				//获取这个专业下的全部的专业方向信息
				List<Map<String, Object>> directList = professDirectionActionImpl.getDirectByprofessId(preParamMap);
				resultMap.put("directList", directList);
			}
			//查询课程库信息
			Map<String, Object> resultAllMap = relationActionImpl.courseList(preParamMap);
			if(resultAllMap != null){
				//返回值
				resultMap.put("courseList", resultAllMap.get("courseList"));
				resultMap.put("totalPage", resultAllMap.get("totalPage"));
				resultMap.put("pageNow", resultAllMap.get("pageNow"));
			}
			resultMap.put("pageSize", preParamMap.get("pageSize"));
			//返回条件
			resultMap.put("departmentId", preParamMap.get("departmentId"));
			resultMap.put("professionId", preParamMap.get("professionId"));
			resultMap.put("mainId", preParamMap.get("mainId"));
			resultMap.put("userName", preParamMap.get("userName"));
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//页面名称
			pageName = "pc/courseListMana";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转课程库页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
	/**
	 * @description  结课管理中-查看虚拟机
	 * 链接：lookForVirtualList?jsonStr={"pageNow":1,"pageSize":10,"classId":63}
	 * @param   跳转：pageNOw pagesize  classId
	 * @param 
	 * @return 
	 * @throws IOException
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/lookForVirtualList", method = RequestMethod.GET)
	public ModelAndView lookForVirtualList(String jsonStr, HttpServletRequest request, HttpServletResponse response) throws IOException {		
		
		//转换json格式工具
		ObjectMapper mapper = new ObjectMapper();
		//存放返回值
		Map<String, Object> returnMap = new HashMap<String, Object>();
		//返回字符串
		String reJsonStr = "";
		//存放页面
		String pageName = "";
		//存放结果值
		Map<String,Object> resultMap = new HashMap<String,Object>();
		//日志信息
		Logger logger = Logger.getLogger(RelationAction.class.getName());
		try {
			Map<String,Object> preParamMap = new HashMap<String, Object>();
			//获取参数值
			if(jsonStr != null){
				preParamMap = mapper.readValue(jsonStr, resultMap.getClass());
			}
			
			//查询本班级全部学生以及每个学生的虚拟机情况
			Map<String, Object> resultAllMap = relationActionImpl.getClassVirtualList(preParamMap);
			if(resultAllMap != null){
				//返回值
				resultMap.put("stuList", resultAllMap.get("stuList"));
				resultMap.put("totalPage", resultAllMap.get("totalPage"));
				resultMap.put("pageNow", resultAllMap.get("pageNow"));
			}
			resultMap.put("pageSize", preParamMap.get("pageSize"));
			//返回条件
			resultMap.put("classId", preParamMap.get("classId"));
			//获取我的消息
			List<Map<String, Object>> noticeList  = courseActionImpl.getMyNotice(request);
			resultMap.put("noticeList", noticeList);
			//获取图片前缀   http://localhost:8081/SchoolManageSystem/images/pc/+文件名
			String[] keysArray = {"server_address", "project_name"};
			Map<String, Object> urlmap = ConfigFileUtil.getFileMessage("UtilFile.properties", keysArray);
			String imageUrl = (String)urlmap.get("server_address")+(String)urlmap.get("project_name")+"images/pc/";
			resultMap.put("imageUrl", imageUrl);
			//查询专业名称，班级名称
			Map<String, Object> detailMsg = classActionImpl.getClassMsgById(preParamMap);
			resultMap.put("detailMsg", detailMsg);
			//页面名称
			pageName = "pc/classVirtualList";
		} catch (Exception e) {
			resultMap.put("errMsg", "跳转页面失败");
			e.printStackTrace();
			logger.error("跳转虚拟机列表页面出现异常", e);
			pageName = "public/pageerror";
		} finally {
			reJsonStr = mapper.writeValueAsString(resultMap);
			returnMap.put("result", reJsonStr);
			System.out.println("返回的  :" + reJsonStr);
		}
		return new ModelAndView(pageName, returnMap);
	}
	
}